Developer --> Technical Publications
PATH Hardware Documentation > Device Managers and Drivers > ATA Devices > ATA Device Software Guide


ATA_FindRefNum

The ATA_FindRefNum function allows an application to determine whether a driver has been installed for a given device. You pass in a device ID and the function returns the current driver reference number registered for the given device. A value of 0 indicates that no driver has been registered. The deviceNextID field contains a device ID of the next device in the list. The end of the list is indicated with a value of 0xFF .

To create a list of all drivers for the attached devices, pass in 0xFF for deviceID . This causes deviceNextID to be filled with the first device in the list. Each successive driver can be found by moving the value returned in deviceNextID into deviceID until the function returns 0xFF in deviceNextID , which indicates the end of the list.

The manager function code for the ATA_FindRefNum function is $86.

The parameter block associated with this function for ataPBVers version 1 is defined as follows:

typedef struct /* Driver registration for */
/* ataPBVers version 1 */
{
ataPBHdr /* ataPBHdr parameter block */
SInt16 drvrRefNum; /* <-- Contains the */
/* driver refNum */
UInt16 FlagReserved; /* Reserved */
UInt16 deviceNextID; /* <-- Contains the next */
/* drive ID */
SInt16 Reserved[21]; /* Reserved */
} ataDrvrRegister;

The parameter block associated with this function for ataPBVer version 2 is defined as follows:

typedef struct /* Driver registration for */
/* ataPBVers version 2 */
/* or greater */
{
ataPBHdr /* ataPBHdr parameter block */
SInt16 drvrRefNum; /* <-- Driver reference number */
UInt16 drvrFlags; /* --> Reserved, set to 0 */
UInt16 deviceNextID; /* Used to specify the next */
/* drive ID */
SInt16 Reserved; /* Reserved (should be 0) */
ProcPtr ataEHandlerPtr; /* <-- Event handler routine */
/* pointer */
SInt32 drvrContext; /* <-- Value to pass in with */
/* event handler */
UInt32 ataEventMask; /* <-- Current setting of the */
/* mask of various events */
/* for event handler */
SInt16 Reserved[14]; /* Reserved */
} ataDrvrRegister;

Field descriptions

ataPBHdr
See the definition of the ataPBHdr parameter block.
drvrRefNum
On return, this field contains the reference number for the device specified in the deviceID field of the ataPBHdr data.
FlagReserved
This field is reserved. To ensure future compatibility, all reserved fields should be set to 0.
deviceNextID
On return, this field contains the deviceID of the next device on the list.
ataEHandlerPtr
Currently registered event handler routine pointer for the selected device. This field is only valid for ataPBVers of 2 or greater.
drvrContext
Currently registered value to be passed along when the event handler is called. This field is only valid for ataPBVers of 2 or greater.
ataEventMask
Current event mask value for the selected device. This field is only valid for ataPBVers of 2 or greater.
Reserved[ nn ]
Reserved. To ensure future compatibility, all reserved fields should be set to 0.
RESULT CODES

See Table A-1 for possible result codes returned by the ATA Manager.


© 1999 Apple Computer, Inc. — (Last Updated 30 Oct 97)

Previous | Back Up One Level | Next | Show Frames | Hide Frames